/*
 * @lc app=leetcode.cn id=1252 lang=javascript
 *
 * [1252] 奇数值单元格的数目
 */

// @lc code=start
/**
 * @param {number} m
 * @param {number} n
 * @param {number[][]} indices
 * @return {number}
 */
var oddCells = function (m, n, indices) {
  const rows = Array(m).fill(0);
  const cols = Array(n).fill(0);
  indices.forEach(([ri, ci]) => {
    rows[ri]++;
    cols[ci]++;
  })
  let res = 0;
  for (let i = 0; i < m; i++) {
    for (let j = 0; j < n; j++) {
      if ((rows[i] + cols[j]) % 2 === 1) {
        res++;
      }
    }
  }
  return res;
};
// @lc code=end
